﻿//-------------------------------------------------------------------
//	Copyright (c) 2012 Fedotov I.V.
//	All rights reserved.
//-------------------------------------------------------------------
/*
	This program is free software: you can redistribute it and/or modify
	it under the terms of the GNU Lesser General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
	GNU Lesser General Public License for more details.

	You should have received a copy of the GNU Lesser General Public License
	along with this program. If not, see http://www.gnu.org/licenses/.

	Project SVN page 
*/

#ifndef ___GLOBAL_H__
#define ___GLOBAL_H__

#include <stdio.h>
#include <vector>
//#include "uniqid_manager.h"
#include "resmanager/resmanager.h"

using namespace std;

class _Global{

	__int64 currentMaxID;

public:

	ResManager RM;
	
	_Global(){
		_CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
		setCurrentMaxID(1);
	}
	
	~_Global(){
	
	}


	__int64 getCurrentMaxID(){
	  return currentMaxID;
	}

	//Следует использовать эту функцию для получения нового уникального идентификатора
	__int64 incAndGetCurrentMaxID(){
		currentMaxID++;
	  return currentMaxID;
	}

	int setCurrentMaxID(__int64 _ID){
		if(_ID<1)return -1;
	  currentMaxID=_ID;
		return 0;
	}
	

};


extern _Global _global;

#endif